#ifndef TABLE_SYMBOLE_HPP
#define TABLE_SYMBOLE_HPP

#include <string>
#include <vector>
#include <map>
using namespace std;

class Symbole{
public:
	string nom;
	int entry;
	string type;
	Symbole(string nom,int entry, string type): nom(nom),entry(entry),type(type){
	}
};

class BlockSymbole{
public:
	vector<Symbole> symboles;
};

class NVariable;

class TableSymboleVariable{
public:
	string nom;
	string type;
	TableSymboleVariable(string nom, string type):nom(nom),type(type){}
};

//fin du vecteur = haut de la pile
class PileSymbole{
public:
	vector<BlockSymbole> blocks;
	int nombre;

	PileSymbole(){
		nombre=0;
	}
	
	void empiler(BlockSymbole bs){
		blocks.push_back(bs); 
	}
	int empilerVariable(TableSymboleVariable v){
		Symbole s(v.nom,nombre++,v.type);
		s.entry=nombre++;
		blocks.back().symboles.push_back(s); 
		return s.entry;
	}
	void depiler(){
		blocks.pop_back();
	}
};

class TableSymbole{

	PileSymbole pile;

public:
	TableSymbole(){
	}
	void ajouter_block(){
		BlockSymbole bs;
		pile.empiler(bs);
	}
	void empiler_variable_dernier_block(TableSymboleVariable variable){
		pile.empilerVariable(variable);
	}
	void depiler(){
		pile.depiler();
	}
};

#endif